<?php
require 'vendor/autoload.php';

$app = new think\App();
$app->initialize();

echo "=== 测试路由 ===\n\n";

// 测试URL生成
$urls = [
    'checkin/store/index',
    'checkin/member/index',
    'admin/menu/index',
];

foreach ($urls as $url) {
    try {
        $fullUrl = url($url)->build();
        echo "✓ {$url} => {$fullUrl}\n";
    } catch (\Exception $e) {
        echo "✗ {$url} => 错误: {$e->getMessage()}\n";
    }
}

echo "\n=== 检查控制器文件 ===\n\n";

$controllers = [
    'app/checkin/controller/Store.php',
    'app/checkin/controller/Member.php',
    'app/admin/controller/Menu.php',
];

foreach ($controllers as $file) {
    if (file_exists($file)) {
        echo "✓ {$file} 存在\n";
    } else {
        echo "✗ {$file} 不存在\n";
    }
}

echo "\n=== 检查应用目录 ===\n\n";

$apps = ['admin', 'wechat', 'checkin'];

foreach ($apps as $app) {
    $path = "app/{$app}";
    if (is_dir($path)) {
        echo "✓ {$path} 目录存在\n";
        
        // 检查必要文件
        $files = ['Service.php', 'controller', 'view'];
        foreach ($files as $file) {
            $fullPath = "{$path}/{$file}";
            if (file_exists($fullPath)) {
                echo "  ✓ {$file}\n";
            } else {
                echo "  ✗ {$file} 缺失\n";
            }
        }
    } else {
        echo "✗ {$path} 目录不存在\n";
    }
    echo "\n";
}

